Python processes the time and date modules, mainly using the datetime, time, and calendar modules. The following article mainly introduces the datetime module in Python. you can refer to it for reference. let's take a look at it. Preface
Python
DateTime is the standard library for Python to process dates and times.Get the current date and timeLet's look at how to get the current date and time: from datetime import datetime>>> now = DateTime.Now () # Gets the current datetime>>> Print /c3>--
ObjectiveInterpretation of related termsThe manifestation of timeTime ModuleDateTime moduleTime Format CodeSummarizeObjectiveIn the development work, we often need to use the date and time, such as:Content output as log informationCalculate the
Example of the usage of the time and datetime modules in Python, pythondatetime
Time module method:Time. time (): Get the timestamp of the current time
Time. localtime (): receives a timestamp and converts it to a tuples of the current time. If no
CausesIn the local database execution test platform database structure file Data_struct.sql, the execution of the build table statement resembles the following:CREATE TABLE' demo ' (' ID ' )int(Ten) unsigned not NULLAuto_increment,' name ' Longtext
This article mainly introduces the usage examples of the time module and datetime module in Python. it mainly demonstrates the printing and calculation of time and date. For more information, see
Time Module method:
Time. time (): Get the
Objective
Python provides several built-in modules for manipulating date times, like Calendar,time,datetime. The interface provided by the time module is basically consistent with the C standard library time.h. The interface of the DateTime module
Python Time module and datetime module detailedOriginal: http://www.cnblogs.com/tkqasn/p/6001134.htmlOne, Time moduleThere are three types of time-performance formats in the Times module:A, timestamp timestamp, which represents the offset calculated
One, Time moduleThere are three types of time-performance formats in the Times module:A, timestamp timestamp, which represents the offset calculated in seconds from January 1, 1970 00:00:00B, struct_time time tuple, a total of nine element groups.C,
There are three types of time-performance formats in the Times module:
A, timestamp timestamp, which represents the offset calculated in seconds from January 1, 1970 00:00:00
B, struct_time time tuple, a total of nine element groups.
C, format time
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.